package edu.sctu.zhengsenwen.month201505.day20150517;

/**
 * Created by user15 on 2015/5/18.
 */
public class TextMore {

    Teacher[] teacher;

    public TextMore(Teacher[] teacher) {

        this.teacher=teacher;
    }

    public void sortNumber(){

        //对老师学号进行排序
        Teacher[] teacherone = new Teacher[teacher.length];

        for(int i=0;i<(teacher.length-1);i++) {
            for (int j = 0; j <(teacher.length-1); j++) {
                if (teacher[j].number > teacher[j + 1].number) {

                    teacherone[0] = teacher[j];
                    teacher[j] = teacher[j + 1];
                    teacher[j + 1] = teacherone[0];

                }
            }
        }
        }

    public void sortStudent(Student[] student){
        //对老师所教学生成绩进行排序
        Student[] studentone = new Student[student.length];

        for(int i=0;i<(student.length-1);i++) {
            for (int j = 0; j <( student.length-1); j++) {
                if (student[j].code > student[j + 1].code) {

                    studentone[0] = student[j];
                    student[j] = student[j + 1];
                    student[j + 1] = studentone[0];
                }
            }

        }

    }

    public Teacher pritCoded(){
        //返回职称为教授的老师的信息


        Teacher returnteacher = null;
        for(Teacher teacher:this.teacher){
            if(teacher.work.equals("教授")){

                returnteacher=teacher;
            }

        }
        return returnteacher;

    }





}
